/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * jFMenuFundo.java
 *
 * Created on 25/11/2009, 13:28:14
 */

package restaurante.forms;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import restaurante.dao.FornecedorDao;
import restaurante.dao.RefeicaoDao;
import restaurante.logica.Fornecedor;
import restaurante.logica.Refeicao;

/**
 *
 * @author Fernanda
 */
public class jFMenuFundo extends javax.swing.JFrame {

 
    /** Creates new form jFMenuFundo */
    public jFMenuFundo() {
        initComponents();
        desabilitarTodasTelas();

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */

    DefaultTableModel tmTelFornecedor = new DefaultTableModel(
            new Object [][]{
            },
            new String[]{"nome","telefone"});

    private List<Fornecedor> fornecedores;
    ListSelectionModel lsmFornecedores;

    public void populaTabela(String busca) throws SQLException{

        FornecedorDao fd = new FornecedorDao();
        fornecedores = fd.getViewTelefone("%"+busca+"%");

        for (Fornecedor f1 : fornecedores) {
            insereTabelaTelFornecedor(f1);
        }
    }

    public void insereTabelaTelFornecedor(Fornecedor f1){

        tmTelFornecedor.addRow(new String[]{
            f1.getNome(),
            f1.getTelefone(),
        });
    }




    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPFundoCadastro = new javax.swing.JPanel();
        jBIngrediente = new javax.swing.JButton();
        jBTelFornecedor = new javax.swing.JButton();
        jBProduto = new javax.swing.JButton();
        jBFuncionario = new javax.swing.JButton();
        jBFornecedor = new javax.swing.JButton();
        jBAlterarEmailFornecedor = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jBRelatorio = new javax.swing.JButton();
        jBNotaFiscal = new javax.swing.JButton();
        jBCadastro = new javax.swing.JButton();
        jBEstoque = new javax.swing.JButton();
        jBVenda = new javax.swing.JButton();
        jBSair = new javax.swing.JButton();
        jPTelFornecedor = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jTBuscaFornecedor = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTTelFornecedor = new javax.swing.JTable();
        jLabel9 = new javax.swing.JLabel();
        jPNumeroNota = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jTNumeroNotaFiscal = new javax.swing.JTextField();
        jBSairNotaFiscal = new javax.swing.JButton();
        jBExecutaNotaFiscal = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jPAlteraEmail = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jTCnpjFornecedor = new javax.swing.JTextField();
        jTEmailFornecedor = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBounds(new java.awt.Rectangle(150, 100, 800, 600));
        setMinimumSize(new java.awt.Dimension(800, 600));
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPFundoCadastro.setBackground(new java.awt.Color(255, 255, 255));
        jPFundoCadastro.setAlignmentX(0.0F);
        jPFundoCadastro.setAlignmentY(0.0F);
        jPFundoCadastro.setDoubleBuffered(false);
        jPFundoCadastro.setFocusable(false);
        jPFundoCadastro.setName("Fundo"); // NOI18N
        jPFundoCadastro.setOpaque(false);
        jPFundoCadastro.setPreferredSize(new java.awt.Dimension(600, 600));
        jPFundoCadastro.setVerifyInputWhenFocusTarget(false);
        jPFundoCadastro.setLayout(null);

        jBIngrediente.setFont(new java.awt.Font("Tahoma", 1, 18));
        jBIngrediente.setText("INGREDIENTE");
        jBIngrediente.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 5, 5, 5, new java.awt.Color(255, 255, 255)));
        jBIngrediente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBIngredienteActionPerformed(evt);
            }
        });
        jPFundoCadastro.add(jBIngrediente);
        jBIngrediente.setBounds(360, 190, 150, 100);

        jBTelFornecedor.setFont(new java.awt.Font("Tahoma", 0, 14));
        jBTelFornecedor.setText("Tel Fornecedores");
        jBTelFornecedor.setBorder(null);
        jBTelFornecedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBTelFornecedorActionPerformed(evt);
            }
        });
        jPFundoCadastro.add(jBTelFornecedor);
        jBTelFornecedor.setBounds(90, 540, 170, 30);

        jBProduto.setFont(new java.awt.Font("Tahoma", 1, 18));
        jBProduto.setText("PRODUTO");
        jBProduto.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 5, 5, 5, new java.awt.Color(255, 255, 255)));
        jBProduto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBProdutoActionPerformed(evt);
            }
        });
        jPFundoCadastro.add(jBProduto);
        jBProduto.setBounds(100, 190, 150, 100);

        jBFuncionario.setFont(new java.awt.Font("Tahoma", 1, 18));
        jBFuncionario.setText("FUNCIONÁRIO");
        jBFuncionario.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 5, 5, 5, new java.awt.Color(255, 255, 255)));
        jBFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBFuncionarioActionPerformed(evt);
            }
        });
        jPFundoCadastro.add(jBFuncionario);
        jBFuncionario.setBounds(360, 390, 150, 100);

        jBFornecedor.setFont(new java.awt.Font("Tahoma", 1, 18));
        jBFornecedor.setText("FORNECEDOR");
        jBFornecedor.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 5, 5, 5, new java.awt.Color(255, 255, 255)));
        jBFornecedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBFornecedorActionPerformed(evt);
            }
        });
        jPFundoCadastro.add(jBFornecedor);
        jBFornecedor.setBounds(100, 390, 150, 100);

        jBAlterarEmailFornecedor.setFont(new java.awt.Font("Tahoma", 0, 14));
        jBAlterarEmailFornecedor.setText("alterar e-mail fornecedor");
        jBAlterarEmailFornecedor.setBorder(null);
        jBAlterarEmailFornecedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBAlterarEmailFornecedorActionPerformed(evt);
            }
        });
        jPFundoCadastro.add(jBAlterarEmailFornecedor);
        jBAlterarEmailFornecedor.setBounds(90, 500, 170, 30);

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 48));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("CADASTROS");
        jPFundoCadastro.add(jLabel2);
        jLabel2.setBounds(50, 40, 500, 80);

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/restaurante/forms/background.jpg"))); // NOI18N
        jLabel3.setText("jLabel1");
        jLabel3.setAlignmentY(0.0F);
        jPFundoCadastro.add(jLabel3);
        jLabel3.setBounds(0, 0, 600, 600);

        getContentPane().add(jPFundoCadastro, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 0, -1, -1));

        jPanel1.setBackground(new java.awt.Color(102, 102, 102));
        jPanel1.setPreferredSize(new java.awt.Dimension(200, 500));

        jBRelatorio.setText("RELATORIO");
        jBRelatorio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBRelatorioActionPerformed(evt);
            }
        });

        jBNotaFiscal.setText("NOTA FISCAL");
        jBNotaFiscal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBNotaFiscalActionPerformed(evt);
            }
        });

        jBCadastro.setText("CADASTRO");
        jBCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBCadastroActionPerformed(evt);
            }
        });

        jBEstoque.setText("ESTOQUE");
        jBEstoque.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBEstoqueActionPerformed(evt);
            }
        });

        jBVenda.setText("VENDA");
        jBVenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBVendaActionPerformed(evt);
            }
        });

        jBSair.setText("SAIR");
        jBSair.setAlignmentY(0.0F);
        jBSair.setPreferredSize(new java.awt.Dimension(160, 50));
        jBSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBSairActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(21, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jBRelatorio, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBSair, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(19, 19, 19))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(189, Short.MAX_VALUE)
                .addComponent(jBRelatorio, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addComponent(jBNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addComponent(jBCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addComponent(jBEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addComponent(jBVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addComponent(jBSair, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, 600));

        jPTelFornecedor.setPreferredSize(new java.awt.Dimension(600, 600));
        jPTelFornecedor.setLayout(null);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Lista de Telefone dos Fornecedores", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel8.setText("Busca");

        jTBuscaFornecedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTBuscaFornecedorActionPerformed(evt);
            }
        });

        jButton3.setFont(new java.awt.Font("Tahoma", 0, 14));
        jButton3.setText("Sair");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setFont(new java.awt.Font("Tahoma", 0, 14));
        jButton4.setText("Buscar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jTTelFornecedor.setModel(tmTelFornecedor);
        jScrollPane1.setViewportView(jTTelFornecedor);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(18, 18, 18)
                        .addComponent(jTBuscaFornecedor, javax.swing.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton4))
                    .addComponent(jButton3))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTBuscaFornecedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton4)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton3)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPTelFornecedor.add(jPanel5);
        jPanel5.setBounds(70, 130, 460, 280);

        jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/restaurante/forms/background.jpg"))); // NOI18N
        jLabel9.setText("jLabel1");
        jLabel9.setAlignmentY(0.0F);
        jPTelFornecedor.add(jLabel9);
        jLabel9.setBounds(0, 0, 600, 600);

        getContentPane().add(jPTelFornecedor, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 0, -1, -1));

        jPNumeroNota.setPreferredSize(new java.awt.Dimension(600, 600));
        jPNumeroNota.setLayout(null);

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Mostrar Nota-Fiscal", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        jLabel7.setBackground(new java.awt.Color(255, 255, 255));
        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel7.setText("Número da Nota-Fiscal");

        jTNumeroNotaFiscal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTNumeroNotaFiscalActionPerformed(evt);
            }
        });

        jBSairNotaFiscal.setFont(new java.awt.Font("Tahoma", 0, 14));
        jBSairNotaFiscal.setText("Sair");
        jBSairNotaFiscal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBSairNotaFiscalActionPerformed(evt);
            }
        });

        jBExecutaNotaFiscal.setFont(new java.awt.Font("Tahoma", 0, 14));
        jBExecutaNotaFiscal.setText("Executar");
        jBExecutaNotaFiscal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBExecutaNotaFiscalActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel7)
                        .addGap(18, 18, 18)
                        .addComponent(jTNumeroNotaFiscal, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addGap(105, 105, 105)
                        .addComponent(jBExecutaNotaFiscal)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
                        .addComponent(jBSairNotaFiscal)))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jTNumeroNotaFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jBExecutaNotaFiscal)
                    .addComponent(jBSairNotaFiscal))
                .addGap(63, 63, 63))
        );

        jPNumeroNota.add(jPanel6);
        jPanel6.setBounds(140, 240, 320, 100);

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/restaurante/forms/background.jpg"))); // NOI18N
        jLabel11.setText("jLabel1");
        jLabel11.setAlignmentY(0.0F);
        jPNumeroNota.add(jLabel11);
        jLabel11.setBounds(0, 0, 600, 600);

        getContentPane().add(jPNumeroNota, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 0, -1, -1));

        jPAlteraEmail.setPreferredSize(new java.awt.Dimension(600, 600));
        jPAlteraEmail.setLayout(null);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Alteração e-mail Fornecedor", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        jLabel5.setBackground(new java.awt.Color(255, 255, 255));
        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel5.setText("CNPJ do Fornecedor:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel6.setText("Novo e-mail:");

        jTCnpjFornecedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTCnpjFornecedorActionPerformed(evt);
            }
        });

        jButton1.setFont(new java.awt.Font("Tahoma", 0, 14));
        jButton1.setText("Sair");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setFont(new java.awt.Font("Tahoma", 0, 14));
        jButton2.setText("Executar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTCnpjFornecedor, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jButton2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
                                .addComponent(jButton1))
                            .addComponent(jTEmailFornecedor, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jTCnpjFornecedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jTEmailFornecedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                        .addComponent(jButton2)
                        .addContainerGap())
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jButton1)
                        .addContainerGap())))
        );

        jPAlteraEmail.add(jPanel4);
        jPanel4.setBounds(140, 240, 320, 150);

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/restaurante/forms/background.jpg"))); // NOI18N
        jLabel4.setText("jLabel1");
        jLabel4.setAlignmentY(0.0F);
        jPAlteraEmail.add(jLabel4);
        jLabel4.setBounds(0, 0, 600, 600);

        getContentPane().add(jPAlteraEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 0, -1, -1));

        jPanel2.setPreferredSize(new java.awt.Dimension(600, 600));
        jPanel2.setLayout(null);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/restaurante/forms/background.jpg"))); // NOI18N
        jLabel1.setText("jLabel1");
        jLabel1.setAlignmentY(0.0F);
        jPanel2.add(jLabel1);
        jLabel1.setBounds(0, 0, 600, 600);

        getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 0, -1, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBCadastroActionPerformed
        desabilitarTodasTelas();
        jPFundoCadastro.setVisible(true);

        // TODO add your handling code here:
}//GEN-LAST:event_jBCadastroActionPerformed

    private void jBEstoqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBEstoqueActionPerformed
        desabilitarTodasTelas();

    }//GEN-LAST:event_jBEstoqueActionPerformed

    private void jBSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSairActionPerformed
        dispose();
    }//GEN-LAST:event_jBSairActionPerformed

    private void jBFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBFuncionarioActionPerformed
        try {
            new jFCadFuncionario().setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(jFMenuFundo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jBFuncionarioActionPerformed

    private void jBIngredienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBIngredienteActionPerformed
        try {
            new jFCadIngrediente().setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(jFMenuFundo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jBIngredienteActionPerformed

    private void jBProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBProdutoActionPerformed
        try {
            new jFCadProduto().setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(jFMenuFundo.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_jBProdutoActionPerformed

    private void jBTelFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBTelFornecedorActionPerformed

        jPTelFornecedor.setVisible(true);
        jPFundoCadastro.setVisible(false);
        try {
            populaTabela(jTBuscaFornecedor.getText());
        } catch (SQLException ex) {
            Logger.getLogger(jFMenuFundo.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_jBTelFornecedorActionPerformed

    private void jBVendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBVendaActionPerformed

        desabilitarTodasTelas();

        Refeicao r1 = new Refeicao();

        r1.setValor_total(0);

          try {
            RefeicaoDao dao = new RefeicaoDao();
            dao.adiciona(r1);

            new jFVenda(r1).setVisible(true);

        } catch (SQLException ex) {
            Logger.getLogger(jFCadFuncionario.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_jBVendaActionPerformed

    private void jBFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBFornecedorActionPerformed
        try {
            new jFCadFornecedor().setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(jFMenuFundo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jBFornecedorActionPerformed

    private void jTCnpjFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTCnpjFornecedorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTCnpjFornecedorActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

        jPAlteraEmail.setVisible(false);
        jPFundoCadastro.setVisible(true);

    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        try {
            String  cnpj,email;
            FornecedorDao dao = new FornecedorDao();

            cnpj = jTCnpjFornecedor.getText();
            email = jTEmailFornecedor.getText();

            dao.alteraEmailFornecedor(cnpj, email);


        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "CNPJ não encontrado!");
        }

        jTCnpjFornecedor.setText("");
        jTEmailFornecedor.setText("");

    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        jPTelFornecedor.setVisible(false);
        jPFundoCadastro.setVisible(true);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        try {
            tmTelFornecedor.setNumRows(0);
            populaTabela(jTBuscaFornecedor.getText());
        } catch (SQLException ex) {
            Logger.getLogger(jFMenuFundo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jTBuscaFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBuscaFornecedorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTBuscaFornecedorActionPerformed

    private void jBAlterarEmailFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAlterarEmailFornecedorActionPerformed
        jPAlteraEmail.setVisible(true);
        jPFundoCadastro.setVisible(false);
    }//GEN-LAST:event_jBAlterarEmailFornecedorActionPerformed

    private void jBNotaFiscalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBNotaFiscalActionPerformed
        desabilitarTodasTelas();
        jPNumeroNota.setVisible(true);
    }//GEN-LAST:event_jBNotaFiscalActionPerformed

    private void jTNumeroNotaFiscalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTNumeroNotaFiscalActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTNumeroNotaFiscalActionPerformed

    private void jBSairNotaFiscalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSairNotaFiscalActionPerformed
        jPNumeroNota.setVisible(false);
    }//GEN-LAST:event_jBSairNotaFiscalActionPerformed

    private void jBExecutaNotaFiscalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBExecutaNotaFiscalActionPerformed
        try {
            // chamar cadastro de funcionario
            new jFNotaFiscal((String)jTNumeroNotaFiscal.getText()).setVisible(true);
        } catch (SQLException ex) {
            Logger.getLogger(jFMenuFundo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jBExecutaNotaFiscalActionPerformed

    private void jBRelatorioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBRelatorioActionPerformed
        desabilitarTodasTelas();
    }//GEN-LAST:event_jBRelatorioActionPerformed

    private void desabilitarTodasTelas(){
        jPTelFornecedor.setVisible(false);
        jPFundoCadastro.setVisible(false);
        jPAlteraEmail.setVisible(false);
        jPNumeroNota.setVisible(false);
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new jFMenuFundo().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBAlterarEmailFornecedor;
    private javax.swing.JButton jBCadastro;
    private javax.swing.JButton jBEstoque;
    private javax.swing.JButton jBExecutaNotaFiscal;
    private javax.swing.JButton jBFornecedor;
    private javax.swing.JButton jBFuncionario;
    private javax.swing.JButton jBIngrediente;
    private javax.swing.JButton jBNotaFiscal;
    private javax.swing.JButton jBProduto;
    private javax.swing.JButton jBRelatorio;
    private javax.swing.JButton jBSair;
    private javax.swing.JButton jBSairNotaFiscal;
    private javax.swing.JButton jBTelFornecedor;
    private javax.swing.JButton jBVenda;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPAlteraEmail;
    private javax.swing.JPanel jPFundoCadastro;
    private javax.swing.JPanel jPNumeroNota;
    private javax.swing.JPanel jPTelFornecedor;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTBuscaFornecedor;
    private javax.swing.JTextField jTCnpjFornecedor;
    private javax.swing.JTextField jTEmailFornecedor;
    private javax.swing.JTextField jTNumeroNotaFiscal;
    private javax.swing.JTable jTTelFornecedor;
    // End of variables declaration//GEN-END:variables

}
